<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var obj = {}
    obj.a = 100

    var arr = []
    arr.a = 200

    function fn() {

    }

    fn.a = 300

    console.log(obj.__proto__)
    console.log(arr.__proto__)
    console.log(fn.__proto__)

    console.log(obj.__proto__ === Object.prototype)

    console.log("==================================")

    function Foo(name, age) {
        this.name = name
    }

    Foo.prototype.alertName = function () {
        alert(this.name)
    }

    var f = new Foo('zhangsan')

    f.printName = function () {
        console.log(this.name)
    }

    f.printName()
    f.alertName()


    let value_all = []
    let value_own = []

    for (item in f) {
        value_all.push(item)
        if (f.hasOwnProperty(item)) {
            value_own.push(item)
        }
    }

    console.log("所有属性:", value_all)
    console.log("自身的属性", value_own)
</script>
</body>
</html>
